package com.lantosec.hmrp.modules.cms.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;

import com.lantosec.hmrp.modules.cms.entity.CmsAttachment;
import com.lantosec.hmrp.core.mvc.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 * CMS文章附件表 VO对象
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="CmsAttachment对象", description="CMS文章附件表")
public class CmsAttachmentVO extends BaseVO<CmsAttachment> {
    private static final long serialVersionUID = 1L;


    public CmsAttachmentVO(CmsAttachment entity){
        this.id = entity.getId();
        this.articleId = entity.getArticleId();
        this.uploadId = entity.getUploadId();
        this.attachmentName = entity.getAttachmentName();
        this.suffix = entity.getSuffix();
        this.editorId = entity.getEditorId();
        this.editorName = entity.getEditorName();
        this.editorTime = entity.getEditorTime();
    }

    @Override
    public CmsAttachment convertToEntity(){
        return new CmsAttachment(this);
    }


    @ApiModelProperty(value = "附件ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "文章ID")
    private Integer articleId;

    @ApiModelProperty(value = "附件上传ID")
    private String uploadId;

    @ApiModelProperty(value = "附件名称")
    private String attachmentName;

    @ApiModelProperty(value = "附件后缀")
    private String suffix;

    @ApiModelProperty(value = "编辑者ID")
    private String editorId;

    @ApiModelProperty(value = "编辑者名称")
    private String editorName;

    @ApiModelProperty(value = "编辑时间")
    private Date editorTime;

    @ApiModelProperty(value = "附件路径")
    private String savePath;
}
